<template>
	<view class="item bg-white" @click="handleGoods(data)">
		<!-- <image class="cu-avatar margin-right-bj" :src="$wanlshop.oss(data.userinfo.avatar)" mode="aspectFill"></image> -->
		<view class="subject">
			<view class="text-cut-2 text-df wanl-gray-dark">
				<text style="margin-right: 4rpx;margin-bottom: 6rpx;" class="cu-tag radius sm bg-green">圈子</text>
				{{data.circleinfo.content}}
			</view>
			
			<view class="imgs">
				<image v-for="(item,index) in data.circleinfo.images_text" :key="index" :src="$wanlshop.oss(item)" mode="aspectFill"></image>
			</view>
			<view class="flex justify-between align-center" >
				<view class="text-df wanl-gray-dark">作者：{{data.userinfo.nickname}}</view>
				<view class="button text-bold text-sm wanl-gray-light">
					<text class="icon-shanchu1 iconfont" @click.stop="loadFollow(data.id, index)"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	export default {
		name: 'wanl-colllect-circle',
		props:{
			data: {
				type: Object,
				default() {
					return {};
				}
			},
		},
		data() {
			return {
				
			}
		},
		computed: {
			...mapState(['user','common'])
		},
		methods: {
			
			handleGoods(item){
				this.$wanlshop.to(`/pages/circle/details?id=${item.circle_id}`)
			},
			
			async loadFollow(id, index) {
				await uni.request({
					url: '/addons/circle/api.collect/del',
					method: 'POST',
					data: {
						ids: id
					},
					success: res => {
						this.$wanlshop.msg('取消收藏')
						this.$emit('delCollect')
					}
				});
			},
		}
	}
</script>

<style lang="less" scoped>

.imgs {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	margin: 10rpx 0;
	flex-wrap: wrap;
	image {
		width: 100rpx;
		height: 100rpx;
		margin-right: 10rpx;
		margin-bottom: 10rpx;
	}
}
</style>
